import Vue from 'vue'
import Router from 'vue-router'
import indexPage from '@/pages/index/Index.vue'
import farmPage from '@/pages/farm/Index.vue'
import farmListPage from '@/pages/farm/list.vue'
import centerPage from '@/pages/my/Index.vue'
import registerPage from '@/pages/login/register.vue'
import loginPage from '@/pages/login/login.vue'
import vipPage from '@/pages/vip/Index.vue'
const ErroPage = resolve => require(['@/common/ErroPage'], resolve)

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      redirect: '/index'
    },
    {
      path: '/index',
      name: 'indexPage',
      component: indexPage,
      meta: {
        keepAlive: false,
        title: '首页'
      }
    },
    {
      path: '/farm',
      name: 'farmPage',
      component: farmPage,
      meta: {
        keepAlive: false,
        title: '有机食品'
      }
    },
    {
      path: '/farm/list',
      name: 'farmListPage',
      component: farmListPage,
      meta: {
        keepAlive: false,
        title: '有机农鲜列表'
      }
    },
    {
      path: '/travel',
      name: 'travelListPage',
      component: () => import('@/pages/travel/Index.vue'),
      meta: {
        keepAlive: false,
        title: '度假旅游'
      }
    },
    {
      path: '/travel/:id',
      name: 'travelDetailPage',
      component: () => import('@/pages/travel/detail.vue'),
      meta: {
        keepAlive: false,
        title: '详情'
      }
    },
    {
      path: '/njx',
      name: 'njxPage',
      component: () => import('@/pages/njx/Index.vue'),
      meta: {
        keepAlive: false,
        title: '有机食品'
      }
    },
    {
      path: '/jgj',
      name: 'jgjPage',
      component: () => import('@/pages/jgj/Index.vue'),
      meta: {
        keepAlive: false,
        title: '金管家'
      }
    },
    {
      path: '/jhs',
      name: 'jhsPage',
      component: () => import('@/pages/jhs/Index.vue'),
      meta: {
        keepAlive: false,
        title: '超值商城'
      }
    },
    {
      path: '/acti',
      name: 'actiPage',
      component: () => import('@/pages/activity/apply.vue'),
      meta: {
        keepAlive: false,
        title: '健康养生'
      }
    },
    {
      path: '/pasture',
      name: 'pasturePage',
      component: () => import('@/pages/old/Index.vue'),
      meta: {
        keepAlive: false,
        title: '高端养老'
      }
    },
    {
      path: '/userinfo',
      name: 'userinfoPage',
      component: () => import('@/pages/my/userinfo.vue'),
      meta: {
        keepAlive: false,
        title: '个人信息'
      }
    },
    {
      path: '/setUp',
      name: 'setUp',
      component: () => import('@/pages/my/setUp.vue'),
      meta: {
        keepAlive: false,
        title: '设置'
      }
    },
    {
      path: '/hybl',
      name: 'hyblPage',
      component: () => import('@/pages/my/hybl.vue'),
      meta: {
        keepAlive: false,
        title: '会员申请'
      }
    },
    {
      path: '/scdd',
      name: 'scddPage',
      component: () => import('@/pages/my/scdd.vue'),
      meta: {
        keepAlive: false,
        title: '商城订单'
      }
    },
    {
      path: '/gwc',
      name: 'gwcPage',
      component: () => import('@/pages/my/gwc.vue'),
      meta: {
        keepAlive: false,
        title: '购物车'
      }
    },
    {
      path: '/newgwc',
      name: 'newgwcPage',
      component: () => import('@/pages/my/newgwc.vue'),
      meta: {
        keepAlive: false,
        title: '购物车'
      }
    },
    {
      path: '/gkjl',
      name: 'gkjlPage',
      component: () => import('@/pages/my/gkjl.vue'),
      meta: {
        keepAlive: false,
        title: '购卡记录'
      }
    },
    {
      path: '/lybmjl',
      name: 'lybmjlPage',
      component: () => import('@/pages/my/lybmjl.vue'),
      meta: {
        keepAlive: false,
        title: '旅游报名订单'
      }
    },
    {
      path: '/zhsz',
      name: 'zhszPage',
      component: () => import('@/pages/my/zhsz.vue'),
      meta: {
        keepAlive: false,
        title: '账户设置'
      }
    },
    {
      path: '/dzgl',
      name: 'dzglPage',
      component: () => import('@/pages/my/dzgl.vue'),
      meta: {
        keepAlive: false,
        title: '地址管理'
      }
    },
    {
      path: '/add',
      name: 'addPage',
      component: () => import('@/pages/my/add.vue'),
      meta: {
        keepAlive: false,
        title: '新增收货人'
      }
    },
    {
      path: '/detail',
      name: 'detailPage',
      component: () => import('@/pages/my/detail.vue'),
      meta: {
        keepAlive: false,
        title: '地址管理'
      }
    },
    {
      path: '/yqhy',
      name: 'yqhyPage',
      component: () => import('@/pages/my/yqhy.vue'),
      meta: {
        keepAlive: false,
        title: '邀约好友'
      }
    },
    {
      path: '/tjlb',
      name: 'tjlbPage',
      component: () => import('@/pages/new/tjlb.vue'),
      meta: {
        keepAlive: false,
        title: '平台风采'
      }
    },
    {
      path: '/tvzs',
      name: 'tvzsPage',
      component: () => import('@/pages/new/tvzs.vue'),
      meta: {
        keepAlive: false,
        title: 'TV展示'
      }
    },
    {
      path: '/yqjl',
      name: 'yqjlPage',
      component: () => import('@/pages/my/yqjl.vue'),
      meta: {
        keepAlive: false,
        title: '邀请记录'
      }
    },
    {
      path: '/wjl',
      name: 'wjlyPage',
      component: () => import('@/pages/my/wjl.vue'),
      meta: {
        keepAlive: false,
        title: '无邀请记录'
      }
    },
    {
      path: '/zhmm',
      name: 'zhmmPage',
      component: () => import('@/pages/login/zhmm.vue'),
      meta: {
        keepAlive: false,
        title: '找回密码'
      }
    },
    {
      path: '/setPassword',
      name: 'setPassword',
      component: () => import('@/pages/set/setPassword.vue'),
      meta: {
        keepAlive: false,
        title: '设置支付密码'
      }
    },
    {
      path: '/forgetPass',
      name: 'forgetPass',
      component: () => import('@/pages/set/forgetPass.vue'),
      meta: {
        keepAlive: false,
        title: '修改支付密码'
      }
    },
    {
      path: '/shopcar',
      name: 'shopcarPage',
      component: () => import('@/pages/shopcar/shopcar.vue'),
      meta: {
        keepAlive: false,
        title: '购物车'
      }
    },
    {
      path: '/signup',
      name: 'signupPage',
      component: () => import('@/pages/signup/signup.vue'),
      meta: {
        keepAlive: false,
        title: '报名记录'
      }
    },
    {
      path: '/memberslist',
      name: 'memberslistPage',
      component: () => import('@/pages/members/memberslist.vue'),
      meta: {
        keepAlive: false,
        title: '会员卡办理'
      }
    },
    {
      path: '/membersdetails',
      name: 'membersdetailsPage',
      component: () => import('@/pages/members/membersdetails.vue'),
      meta: {
        keepAlive: false,
        title: '会员卡详情'
      }
    },
    {
      path: '/memberCenter',
      name: 'memberCenter',
      component: () => import('@/pages/members/memberCenter.vue'),
      meta: {
        keepAlive: false,
        title: '会员中心'
      }
    },
    {
      path: '/bonusList',
      name: 'bonusList',
      component: () => import('@/pages/members/bonusList.vue'),
      meta: {
        keepAlive: false,
        title: '奖励金列表'
      }
    },
    {
      path: '/recommendList',
      name: 'recommendList',
      component: () => import('@/pages/members/recommendList.vue'),
      meta: {
        keepAlive: false,
        title: '推荐列表'
      }
    },
    {
      path: '/applyCash',
      name: 'applyCash',
      component: () => import('@/pages/members/applyCash.vue'),
      meta: {
        keepAlive: false,
        title: '申请提现'
      }
    },
    {
      path: '/cashRecord',
      name: 'cashRecord',
      component: () => import('@/pages/members/cashRecord.vue'),
      meta: {
        keepAlive: false,
        title: '提现记录'
      }
    },
    {
      path: '/integralMange',
      name: 'integralMange',
      component: () => import('@/pages/adminis/integralMange.vue'),
      meta: {
        keepAlive: false,
        title: '我的积分'
      }
    },
    {
      path: '/integralDetailed',
      name: 'integralDetailed',
      component: () => import('@/pages/adminis/integralDetailed.vue'),
      meta: {
        keepAlive: false,
        title: '积分明细'
      }
    },
    {
      path: '/exchangeDalance',
      name: 'exchangeDalance',
      component: () => import('@/pages/adminis/exchangeDalance.vue'),
      meta: {
        keepAlive: false,
        title: '兑换余额'
      }
    },
    {
      path: '/help',
      name: 'help',
      component: () => import('@/pages/adminis/help.vue'),
      meta: {
        keepAlive: false,
        title: '帮助说明'
      }
    },
    {
      path: '/balanceMange',
      name: 'balanceMange',
      component: () => import('@/pages/adminis/balanceMange.vue'),
      meta: {
        keepAlive: false,
        title: '我的钱包'
      }
    },

    {
      path: '/detailed',
      name: 'detailed',
      component: () => import('@/pages/adminis/detailed.vue'),
      meta: {
        keepAlive: false,
        title: '余额明细'
      }
    },
    {
      path: '/recharge',
      name: 'recharge',
      component: () => import('@/pages/adminis/rechargeFace.vue'),
      meta: {
        keepAlive: false,
        title: '在线充值'
      }
    },
    {
      path: '/rechargeFace',
      name: 'rechargeFace',
      component: () => import('@/pages/adminis/rechargeFace.vue'),
      meta: {
        keepAlive: false,
        title: '充值界面'
      }
    },
    {
      path: '/newrecharge',
      name: 'newrecharge',
      component: () => import('@/pages/adminis/rechargeFace.vue'),
      meta: {
        keepAlive: false,
        title: '会员办理'
      }
    },
    {
      path: '/exprecharge',
      name: 'exprecharge',
      component: () => import('@/pages/adminis/rechargeFace.vue'),
      meta: {
        keepAlive: false,
        title: '会员办理'
      }
    },
    {
      path: '/rechargeMange',
      name: 'rechargeMange',
      component: () => import('@/pages/adminis/rechargeMange.vue'),
      meta: {
        keepAlive: false,
        title: '充值跳转'
      }
    },
    {
      path: '/cash',
      name: 'cash',
      component: () => import('@/pages/adminis/cash.vue'),
      meta: {
        keepAlive: false,
        title: '提现'
      }
    },
    {
      path: '/exchange',
      name: 'exchange',
      component: () => import('@/pages/adminis/exchange.vue'),
      meta: {
        keepAlive: false,
        title: '兑换积分'
      }
    },
    {
      path: '/exclusive',
      name: 'mexclusive',
      component: () => import('@/pages/exclusive/mexclusive.vue'),
      meta: {
        keepAlive: false,
        title: '会员福利'
      }
    },
    {
      path: '/guest',
      name: 'guestSpace',
      component: () => import('@/pages/exclusive/guestSpace.vue'),
      meta: {
        keepAlive: false,
        title: '推荐列表'
      }
    },
    {
      path: '/bonusRuler',
      name: 'bonusRuler',
      component: () => import('@/pages/exclusive/bonusRuler.vue'),
      meta: {
        keepAlive: false,
        title: '奖金规则'
      }
    },
    {
      path: '/shiming',
      name: 'shimingPage',
      component: () => import('@/pages/setting/shiming.vue'),
      meta: {
        keepAlive: false,
        title: '会员认证'
      }
    },
    {
      path: '/smregular',
      name: 'smregularPage',
      component: () => import('@/pages/setting/smregular.vue'),
      meta: {
        keepAlive: false,
        title: '会员规则'
      }
    },
    {
      path: '/jhsdetails',
      name: 'jhsdetailsPage',
      component: () => import('@/pages/jhs/jhsdetails.vue'),
      meta: {
        keepAlive: false,
        title: '热门推荐'
      }
    },
    {
      path: '/njxdetails',
      name: 'njxdetailsPage',
      component: () => import('@/pages/njx/njxdetails.vue'),
      meta: {
        keepAlive: false,
        title: '商品详情'
      }
    },
    {
      path: '/orderDetail',
      name: 'orderDetailPage',
      component: () => import('@/pages/order/orderDetail.vue'),
      meta: {
        keepAlive: false,
        title: '生成订单'
      }
    },
    {
      path: '/center',
      name: 'centerPage',
      component: centerPage,
      meta: {
        keepAlive: false,
        title: '我的'
      }
    },
    {
      path: '/register',
      name: 'registerPage',
      component: registerPage,
      meta: {
        keepAlive: true,
        title: '注册'
      }
    },
    {
      path: '/login',
      name: 'loginPage',
      component: loginPage,
      meta: {
        keepAlive: true,
        title: '登录'
      }
    },
    {
      path: '/vip',
      name: 'VipPage',
      component: vipPage,
      meta: {
        keepAlive: true,
        title: '会员'
      }
    },
    {
      path: '/superValue',
      name: 'superValue',
      component: () => import('@/pages/tourism/superValue.vue'),
      meta: {
        keepAlive: false,
        title: '休闲旅游'
      }
    },
    {
      path: '/amusement',
      name: 'amusement',
      component: () => import('@/pages/tourism/amusement.vue'),
      meta: {
        keepAlive: false,
        title: '蓄乐游'
      }
    },
    {
      path: '/tourProduct',
      name: 'tourProduct',
      component: () => import('@/pages/tourism/tourProduct.vue'),
      meta: {
        keepAlive: false,
        title: '旅游详情'
      }
    },
    {
      path: '/tourOrder',
      name: 'tourOrder',
      component: () => import('@/pages/tourism/tourOrder.vue'),
      meta: {
        keepAlive: false,
        title: '订单填写'
      }
    },
    {
      path: '/addFriends',
      name: 'addFriends',
      component: () => import('@/pages/tourism/addFriends.vue'),
      meta: {
        keepAlive: false,
        title: '添加亲友'
      }
    },
    {
      path: '/modFriends',
      name: 'modFriends',
      component: () => import('@/pages/tourism/modFriends.vue'),
      meta: {
        keepAlive: false,
        title: '修改信息'
      }
    },
    {
      path: '/tourList',
      name: 'tourList',
      component: () => import('@/pages/tourism/tourList.vue'),
      meta: {
        keepAlive: false,
        title: '旅游订单'
      }
    },
    {
      path: '/saleApply',
      name: 'saleApply',
      component: () => import('@/pages/tourism/saleApply.vue'),
      meta: {
        keepAlive: false,
        title: '售后申请'
      }
    },
    {
      path: '/saleDetails',
      name: 'saleDetails',
      component: () => import('@/pages/tourism/saleDetails.vue'),
      meta: {
        keepAlive: false,
        title: '售后详情'
      }
    },
    {
      path: '/tourDetails',
      name: 'tourDetails',
      component: () => import('@/pages/tourism/tourDetails.vue'),
      meta: {
        keepAlive: false,
        title: '订单详情'
      }
    },
    {
      path: '/agApply',
      name: 'agApply',
      component: () => import('@/pages/agent/agApply.vue'),
      meta: {
        keepAlive: true,
        title: '短信验证'
      }
    },
    {
      path: '/fxxk',
      name: 'fxxk',
      component: () => import('@/pages/activity/fxxk.vue'),
      meta: {
        keepAlive: true,
        title: '短信验证'
      }
    },
    {
      path: '/agQuestion',
      name: 'agQuestion',
      component: () => import('@/pages/agent/agQuestion.vue'),
      meta: {
        keepAlive: true,
        title: '问卷调查'
      }
    },
    {
      path: '/agInfor',
      name: 'agInfor',
      component: () => import('@/pages/agent/agInfor.vue'),
      meta: {
        keepAlive: true,
        title: '信息填写'
      }
    },
    // {
    //   path: '/agLogin',
    //   name: 'agLogin',
    //   component: () => import('@/pages/agent/agLogin.vue'),
    //   meta: {
    //     keepAlive: false,
    //     title: '代理人登录'
    //   }
    // },
    {
      path: '/agProg',
      name: 'agProg',
      component: () => import('@/pages/agent/agProg.vue'),
      meta: {
        keepAlive: false,
        title: '申请进度'
      }
    },
    {
      path: '/agCation',
      name: 'agCation',
      component: () => import('@/pages/agent/agCation.vue'),
      meta: {
        keepAlive: false,
        title: '立即申请'
      }
    },
    {
      path: '/agExplain',
      name: 'agExplain',
      component: () => import('@/pages/agent/agExplain.vue'),
      meta: {
        keepAlive: false,
        title: '代理说明'
      }
    },
    {
      path: '/agMent',
      name: 'agMent',
      component: () => import('@/pages/agent/agMent.vue'),
      meta: {
        keepAlive: false,
        title: '代理协议'
      }
    },
    {
      path: '/bankCard',
      name: 'bankCard',
      component: () => import('@/pages/agent/bankCard.vue'),
      meta: {
        keepAlive: true,
        title: '银行卡'
      }
    },
    {
      path: '/userInfoShow',
      name: 'userInfoShow',
      component: () => import('@/pages/agent/userInfoShow.vue'),
      meta: {
        keepAlive: true,
        title: '个人信息'
      }
    },
    {
      path: '/vipList',
      name: 'vipList',
      component: () => import('@/pages/agent/vipList.vue'),
      meta: {
        keepAlive: true,
        title: '会员列表'
      }
    },
    {
      path: '/ckhelp',
      name: 'ckhelp',
      component: () => import('@/pages/agent/ckhelp.vue'),
      meta: {
        keepAlive: true,
        title: '客服与帮助'
      }
    },
    {
      path: '/txRecord',
      name: 'txRecord',
      component: () => import('@/pages/agent/txRecord.vue'),
      meta: {
        keepAlive: true,
        title: '提现记录'
      }
    },
    {
      path: '/yjRecord',
      name: 'yjRecord',
      component: () => import('@/pages/agent/yjRecord.vue'),
      meta: {
        keepAlive: true,
        title: '佣金记录'
      }
    },
    {
      path: '/ckCenter',
      name: 'ckCenter',
      component: () => import('@/pages/agent/ckCenter.vue'),
      meta: {
        keepAlive: false,
        title: '代理中心'
      }
    },
    {
      path: '/txRecommend',
      name: 'txRecommend',
      component: () => import('@/pages/agent/txRecommend.vue'),
      meta: {
        keepAlive: false,
        title: '申请提现'
      }
    },
    {
      path: '/selectType',
      name: 'selectType',
      component: () => import('@/pages/agent/selectType.vue'),
      meta: {
        keepAlive: false,
        title: '选择类型'
      }
    },
    {
      path: '/selectToShow',
      name: 'selectToShow',
      component: () => import('@/pages/agent/selectToShow.vue'),
      meta: {
        keepAlive: false,
        title: '代理保证金'
      }
    },
    {
      path: '/search',
      name: 'searchPage',
      component: () => import('@/pages/njx/search.vue'),
      meta: {
        keepAlive: false,
        title: '搜索'
      }
    },
    {
      path: '/scddPay',
      name: 'scddPayPage',
      component: () => import('@/pages/my/scddPay.vue'),
      meta: {
        keepAlive: false,
        title: '订单结算'
      }
    },
    {
      path: '/scddDetails',
      name: 'scddDetailsPage',
      component: () => import('@/pages/my/scddDetails.vue'),
      meta: {
        keepAlive: false,
        title: '商城订单详情'
      }
    },
    {
      path: '/scddWuliu',
      name: 'scddWuliuPage',
      component: () => import('@/pages/my/scddWuliu.vue'),
      meta: {
        keepAlive: false,
        title: '追踪物流'
      }
    },
    {
      path: '/afterSail',
      name: 'afterSailPage',
      component: () => import('@/pages/order/afterSail.vue'),
      meta: {
        keepAlive: false,
        title: '售后申请'
      }
    },
    {
      path: '/afterDetails',
      name: 'afterDetailsPage',
      component: () => import('@/pages/order/afterDetails.vue'),
      meta: {
        keepAlive: false,
        title: '售后详情'
      }
    },
    {
      path: '/afterSailDetails',
      name: 'afterSailDetailsPage',
      component: () => import('@/pages/order/afterSailDetails.vue'),
      meta: {
        keepAlive: false,
        title: '售后申请'
      }
    },
    {
      path: '*',
      component: ErroPage,
      meta: {
        keepAlive: true,
        title: '找不到页面',
        index: 1
      }
    }
  ]
  // scrollBehavior (to, from, savedPosition) {
  //   if (savedPosition) {
  //     // return savedPosition
  //     return { x: 0, y: 0 }
  //   } else {
  //     // if (from.meta.keepAlive) {
  //     //   from.meta.savedPosition = document.body.scrollTop
  //     // }
  //     // return { x: 0, y: to.meta.savedPosition || 0 }
  //     return { x: 0, y: 0 }
  //   }
  // },

})
